package com.study.servlet;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @PackgeName: com.study.servlet
 * @ClassName: LonoutServlet
 * @Author: 严志祥
 * Date: 2022-05-11 19:36
 * project name: web_project_medal
 * @Version:
 * @Description:
 */
@WebServlet("/logout.let")
public class LogoutServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        req.getSession().invalidate();//注销会话
//        req.getSession().setMaxInactiveInterval(30);//设置超时时间，分钟
        resp.sendRedirect(req.getContextPath()+"/login.html");//重定向到登录页面
    }
}
